Technote ME 02 | September 1987 |
For example, use of a handle to store a GrafPort can be particularly dangerous. A GrafPort must not move between the time that it is opened (OpenPort, NewWindow, NewDialog, etc.) and the time that it is closed (ClosePort, DisposeWindow, DisposDialog, etc.). Color QuickDraw keeps a list of open ports and pointers to them, so, if you create a GrafPort and it moves while still open, Color QuickDraw will (unknowingly) have a pointer to outer space instead of a pointer to a GrafPort. When it needs to use that pointer, it will get hopelessly confused and probably issue a system error to let you know.
As an aside, if you open a port by calling OpenPort or
OpenCPort, you should always close the port by calling
ClosePort or CloseCPort before calling DisposPtr on
the port or you will orphan handles (visRgn, clipRgn and
more).
Further Reference:
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help